package com.hyl.boottest.util;

import lombok.Data;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * @Description TODO
 * @Author hyl
 * @Date 2023/3/16 9:11
 **/
@Data
public class PageUtil<T> implements Serializable {
	private List<T> data;

	private Integer currentPage;
	private Integer showSize;
	//计算
	private  Integer total;//总行数
	private Integer totalPage;//总页数

	public PageUtil() {
	}

	public PageUtil(List<T> data, Integer currentPage, Integer showSize, Integer total) {
		this.data = data;
		this.currentPage = currentPage;
		this.showSize = showSize;
		this.total = total;
	}

	public Integer getTotalPage() {
		totalPage = total%showSize==0 ? total/showSize : total/showSize+1;
		return totalPage;
	}
}
